package com.fivefu.core.data.services.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fivefu.base.common.utils.str.StrUtils;
import com.fivefu.core.data.entity.DbFfskyeyePlatform;
import com.fivefu.core.data.mapper.DbFfskyeyePlatformMapper;
import com.fivefu.core.data.services.DbFfskyeyePlatformService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 平台 服务实现类
 * </p>
 *
 * @author 
 * @since 2023-03-28 10:07:23
 */
@Service
public class DbFfskyeyePlatformServiceImpl extends ServiceImpl<DbFfskyeyePlatformMapper, DbFfskyeyePlatform> implements DbFfskyeyePlatformService {

    /**
     * 查询平台列表
     * @return
     */
    @Override
    public List<DbFfskyeyePlatform> queryPlatformList(){
        QueryWrapper<DbFfskyeyePlatform> wrapper = new QueryWrapper<>();
        wrapper.eq("is_delete",0);
        List<DbFfskyeyePlatform> list = baseMapper.selectList(wrapper);
        return list;
    }

    /**
     * 通过平台名称查询平台信息
     * @param platformName 平台名称
     * @return
     */
    @Override
    public DbFfskyeyePlatform queryPlatformByName(String platformName){
        QueryWrapper<DbFfskyeyePlatform> wrapper = new QueryWrapper<>();
        wrapper.eq("is_delete",0);
        if (StrUtils.isNotNull(platformName)){
            wrapper.eq("platform_name", platformName);
        }
        DbFfskyeyePlatform platform = baseMapper.selectOne(wrapper);
        return platform;
    }

    /**
     * 通过平台名称查询平台信息
     * @param platformCode 平台标识
     * @return
     */
    @Override
    public DbFfskyeyePlatform queryPlatformByCode(String platformCode){
        QueryWrapper<DbFfskyeyePlatform> wrapper = new QueryWrapper<>();
        wrapper.eq("is_delete",0);
        if (StrUtils.isNotNull(platformCode)){
            wrapper.eq("platform_code", platformCode);
        }
        DbFfskyeyePlatform platform = baseMapper.selectOne(wrapper);
        return platform;
    }

}
